Redundant variable definitions in lowhashtest
Categories
(NSS :: Test, enhancement)
Tracking
(Not tracked)
People
(Reporter: luhuaxin1, Unassigned)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Steps to reproduce:
In lowhashtest.c, all the test_long_message_<alg> functions have an unused array definition 'buf':
static int
test_long_message_sha1(NSSLOWInitContext initCtx)
{
PRUint8 results[SHA1_LENGTH];
/ Test vector from FIPS 180-2: appendix B.3. */
/* 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f. */
static const PRUint8 expected[SHA256_LENGTH] = { 0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4, 0xf6, 0x1e, 0xeb, 0x2b,
0xdb, 0xad, 0x27, 0x31, 0x65, 0x34, 0x01, 0x6f };
unsigned char buf[1000];
(void)PORT_Memset(buf, 'a', sizeof(buf));
return test_long_message(initCtx, HASH_AlgSHA1,
SHA1_LENGTH, &expected[0], results);
}
Actual results:
Redundant code and processes.
Expected results:
These lines can be removed.
(In reply to Huaxin Lu from comment #0)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Steps to reproduce:
In lowhashtest.c, all the test_long_message_<alg> functions have an unused array definition 'buf':
static int
test_long_message_sha1(NSSLOWInitContext initCtx)
{
PRUint8 results[SHA1_LENGTH];
/ Test vector from FIPS 180-2: appendix B.3. *//* 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f. */ static const PRUint8 expected[SHA256_LENGTH] = { 0x34, 0xaa, 0x97, 0x3c, 0xd4, 0xc4, 0xda, 0xa4, 0xf6, 0x1e, 0xeb, 0x2b, 0xdb, 0xad, 0x27, 0x31, 0x65, 0x34, 0x01, 0x6f };
unsigned char buf[1000];
(void)PORT_Memset(buf, 'a', sizeof(buf));
return test_long_message(initCtx, HASH_AlgSHA1,
SHA1_LENGTH, &expected[0], results);
}Actual results:
Redundant code and processes.
Expected results:
These lines can be removed.
Comment 3•3 years ago
|
||
Description
•